<template>
  <div class="header">
    <div class="menu fl">
      <img src="./menu.png" alt="">
    </div>
    <div class="nav">
      <mu-bottom-nav :value="bottomNav" @change="handleChange">
        <mu-bottom-nav-item value="music" title="music"/>
        <mu-bottom-nav-item value="main" title="main"/>
        <mu-bottom-nav-item value="user" title="user"/>
      </mu-bottom-nav>
    </div>
    <div class="search fr">
      <img src="./search.png" alt="">
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
  import {mapGetters} from 'vuex'
  export default{
    data () {
      return {
        bottomNav: 'main'
      }
    },
    methods: {
      handleChange (val) {
        this.bottomNav = val
        if (val === 'main') {
          this.$router.push(`/${val}/${this.recommendrouter}`)
        } else {
          this.$router.push(`/${val}`)
        }
      }
    },
    computed: {
      ...mapGetters([
        'recommendrouter'
      ])
    }
  }
</script>

<style>
  .header {
    height: 4rem;
    background: #C20C0C;
    text-align: center;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 10;
  }

  .header .menu, .header .search {
    width: 2rem;
    height: 2rem;
    margin: 1rem;
  }

  .header img {
    width: 2rem;
  }

  .header .nav {
    display: inline-block;
    width: calc(100% - 8rem);
    line-height: 3rem;
  }

  .header .mu-bottom-nav {
    background: #C20C0C;
    height: 4rem;
  }

  .header .mu-buttom-item {
    color: #ccc;
  }

  .header .mu-bottom-item-text {
    font-size: 1.4rem;
  }

  .header .mu-bottom-item-active .mu-bottom-item-text {
    color: #fff;
  }
</style>
